Skip to content

[RNE Rewrite] feat: support offset and length options in Tensor.copyTo#1287

Merged
barhanc merged 2 commits into
rne-rewritefrom
@bh/tensor-copy-to-options
Jun 29, 2026
Merged

[RNE Rewrite] feat: support offset and length options in Tensor.copyTo#1287
barhanc merged 2 commits into
rne-rewritefrom
@bh/tensor-copy-to-options

Conversation

@barhanc

@barhanc barhanc commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Extends Tensor.copyTo() to support optional offset and length configuration parameters. This allows copying a slice/sub region of a source tensor into a destination tensor, which is useful for tasks such as extracting rows from a batched tensor.

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

  • If you want rebuild example apps and check that nothing is broken.

Screenshots

Related issues

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@barhanc barhanc self-assigned this Jun 26, 2026
@barhanc barhanc added refactoring feature PRs that implement a new feature Core labels Jun 26, 2026
@barhanc barhanc requested a review from msluszniak June 26, 2026 18:39
@barhanc barhanc changed the title feat: support offset and length options in Tensor.copyTo [RNE Rewrite] feat: support offset and length options in Tensor.copyTo Jun 26, 2026
Comment thread packages/react-native-executorch/cpp/core/tensor.cpp

@msluszniak msluszniak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demo apps with semantic segmentation and style transfer does not work with this change, I got error: Value is undefined, expected an Object. Other models, namely object detection, kepoint detection and classification works correctly.

@barhanc

barhanc commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Demo apps with semantic segmentation and style transfer does not work with this change, I got error: Value is undefined, expected an Object. Other models, namely object detection, kepoint detection and classification works correctly.

It works fine for me, did you do a clean rebuild?

@msluszniak

Copy link
Copy Markdown
Member

Yeah, stale caches.

@barhanc barhanc merged commit 477086c into rne-rewrite Jun 29, 2026
2 checks passed
@barhanc barhanc deleted the @bh/tensor-copy-to-options branch June 29, 2026 10:44
msluszniak added a commit that referenced this pull request Jun 29, 2026
## Description

Adds instance segmentation task pipeline and corresponding example
screen in computer-vision app.

### Introduces a breaking change?

- [ ] Yes
- [x] No

### Type of change

- [ ] Bug fix (change which fixes an issue)
- [x] New feature (change which adds functionality)
- [ ] Documentation update (improves or adds clarity to existing
documentation)
- [ ] Other (chores, tests, code style improvements etc.)

### Tested on

- [x] iOS
- [ ] Android

### Testing instructions

- [ ] Build computer vision app on both Android and iOS
- [ ] Test the newly added instance segmentation screen
- [ ] Check the modified HF repos:
-
https://huggingface.co/software-mansion/react-native-executorch-fast-sam
-
https://huggingface.co/software-mansion/react-native-executorch-rfdetr-nano-segmentation
-
https://huggingface.co/software-mansion/react-native-executorch-fast-sam

### Screenshots

<!-- Add screenshots here, if applicable -->

### Related issues

Closes #1238 

### Checklist

- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly
- [x] My changes generate no new warnings

### Additional notes

Can be merged only after #1287

---------

Co-authored-by: Mateusz Sluszniak <56299341+msluszniak@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core feature PRs that implement a new feature refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants